package com.example.login.controller;

import com.example.common.domain.Result;
import com.example.login.domain.dto.UserLoginDTO;
import com.example.login.domain.vo.UserLoginVO;
import com.example.login.service.UserAuthService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name="用户登录接口相关")
@Slf4j
@RestController
@RequestMapping("/login/user")
@RequiredArgsConstructor
public class UserLoginController {
    private final UserAuthService userService;

    @PostMapping("/wxLogin")
    public Result<UserLoginVO> wxLogin(@RequestBody UserLoginDTO userLoginDTO) throws Exception {
        UserLoginVO userLoginVO = userService.weixinLogin(userLoginDTO);
        return Result.success(userLoginVO);
    }

}
